]> git.r.bdr.sh - rbdr/super-polarity/blobdiff - Super Polarity/SuperPolarity.cs
I think bullets come out now.
[rbdr/super-polarity] / Super Polarity / SuperPolarity.cs
index c43582eda87f868913b405e0824ad6f8db0e3eb7..21d1ed444af2f0cec8fcdfaa2e2c3d8005471fdc 100644 (file)
@@ -20,11 +20,7 @@ namespace SuperPolarity
         public static GraphicsDeviceManager graphics;
         SpriteBatch spriteBatch;
 
-        // Input Handler
-        KeyboardState currentKeyboardState;
-        GamePadState currentGamePadState;
-
-        MainShip player;
+        public static int OutlierBounds;
 
         public SuperPolarity()
             : base()
@@ -32,6 +28,9 @@ namespace SuperPolarity
             SuperPolarity.graphics = new GraphicsDeviceManager(this);
             SuperPolarity.graphics.PreferMultiSampling = true;
             Content.RootDirectory = "Content";
+            ActorFactory.SetGame(this);
+            ParticleEffectFactory.SetGame(this);
+            ActorManager.SetGame(this);
         }
 
         /// <summary>
@@ -42,9 +41,15 @@ namespace SuperPolarity
         /// </summary>
         protected override void Initialize()
         {
-            player = new MainShip();
-
             base.Initialize();
+
+            OutlierBounds = 100;
+
+            InputController.RegisterEventForButton("changePolarity", Buttons.A);
+            InputController.RegisterEventForKey("changePolarity", Keys.Z);
+
+            InputController.RegisterEventForButton("shoot", Buttons.X);
+            InputController.RegisterEventForKey("shoot", Keys.X);
         }
 
         /// <summary>
@@ -58,7 +63,9 @@ namespace SuperPolarity
 
             Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
 
-            player.Initialize(Content, Content.Load<Texture2D>("Graphics\\main-ship"), playerPosition);
+            Renderer.CheckIn(ActorFactory.CreateMainShip(playerPosition));
+            Renderer.CheckIn(ActorFactory.CreateShip(Ship.Polarity.Positive, new Vector2(200, 200)));
+            Renderer.CheckIn(ActorFactory.CreateShip(Ship.Polarity.Negative, new Vector2(400, 200)));
         }
 
         /// <summary>
@@ -83,7 +90,7 @@ namespace SuperPolarity
             // TODO: Add your update logic here
 
             InputController.UpdateInput();
-            player.Update(gameTime);
+            ActorManager.Update(gameTime);
 
             base.Update(gameTime);
         }
@@ -98,7 +105,7 @@ namespace SuperPolarity
 
             spriteBatch.Begin();
 
-            player.Draw(spriteBatch);
+            Renderer.Draw(spriteBatch);
 
             spriteBatch.End();